/**
 * @file image_processor_v300.h
 *
 * Copyright (c) Huawei Technologies Co., Ltd. 2022. All rights reserved.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */

#ifndef IMAGE_PROCESSOR_V300_H
#define IMAGE_PROCESSOR_V300_H

#include "single_op/dvpp/v200/image_processor_v200.h"

namespace acl {
    namespace dvpp {
    class ImageProcessorV300 : public ImageProcessorV200 {
    public:
        aclError acldvppSetResizeConfigInterpolation(acldvppResizeConfig *const resizeConfig,
                                                     const uint32_t interpolation) override;
        aclError acldvppCreateChannel(acldvppChannelDesc *const channelDesc) override;
        aclError acldvppDestroyChannel(acldvppChannelDesc *const channelDesc) override;
        aclError acldvppJpegDecodeAsync(acldvppChannelDesc *const channelDesc,
                                        const void *const data,
                                        const uint32_t size,
                                        acldvppPicDesc *const outputDesc,
                                        const aclrtStream stream) override;

        aclError acldvppJpegEncodeAsync(acldvppChannelDesc *const channelDesc,
                                        acldvppPicDesc *const inputDesc,
                                        const void *const data,
                                        uint32_t *const size,
                                        acldvppJpegeConfig *const config,
                                        const aclrtStream stream) const override;

        aclError acldvppJpegGetImageInfo(const void *const data,
                                         const uint32_t size,
                                         uint32_t *const width,
                                         uint32_t *const height,
                                         int32_t *const components,
                                         acldvppJpegFormat *const format) const override;

        aclError acldvppJpegPredictEncSize(const acldvppPicDesc *const inputDesc,
                                           const acldvppJpegeConfig *const config,
                                           uint32_t *const size) const override;

        aclError acldvppJpegPredictDecSize(const void *const data,
                                           const uint32_t dataSize,
                                           const acldvppPixelFormat outputPixelFormat,
                                           uint32_t *const decSize) override;

        aclError acldvppVpcResizeAsync(acldvppChannelDesc *const channelDesc,
                                       acldvppPicDesc *const inputDesc,
                                       acldvppPicDesc *const outputDesc,
                                       acldvppResizeConfig *const resizeConfig,
                                       const aclrtStream stream) const override;

        aclError acldvppVpcCropAsync(acldvppChannelDesc *const channelDesc,
                                     acldvppPicDesc *const inputDesc,
                                     acldvppPicDesc *const outputDesc,
                                     acldvppRoiConfig *const cropArea,
                                     const aclrtStream stream) override;

        aclError acldvppVpcCropResizeAsync(acldvppChannelDesc *const channelDesc,
                                           acldvppPicDesc *const inputDesc,
                                           acldvppPicDesc *const outputDesc,
                                           acldvppRoiConfig *const cropArea,
                                           acldvppResizeConfig *const resizeConfig,
                                           const aclrtStream stream) override;

        aclError acldvppVpcBatchCropAsync(acldvppChannelDesc *const channelDesc,
                                          acldvppBatchPicDesc *const srcBatchPicDescs,
                                          uint32_t *const roiNums,
                                          const uint32_t size,
                                          acldvppBatchPicDesc *const dstBatchPicDescs,
                                          acldvppRoiConfig *cropAreas[],
                                          const aclrtStream stream) override;

        aclError acldvppVpcBatchCropResizeAsync(acldvppChannelDesc *const channelDesc,
                                                acldvppBatchPicDesc *const srcBatchPicDescs,
                                                uint32_t *const roiNums,
                                                const uint32_t size,
                                                acldvppBatchPicDesc *const dstBatchPicDescs,
                                                acldvppRoiConfig *cropAreas[],
                                                acldvppResizeConfig *const resizeConfig,
                                                const aclrtStream stream) override;

        aclError acldvppVpcCropAndPasteAsync(acldvppChannelDesc *const channelDesc,
                                             acldvppPicDesc *const inputDesc,
                                             acldvppPicDesc *const outputDesc,
                                             acldvppRoiConfig *const cropArea,
                                             acldvppRoiConfig *const pasteArea,
                                             const aclrtStream stream) override;

        aclError acldvppVpcCropResizePasteAsync(acldvppChannelDesc *const channelDesc,
                                                acldvppPicDesc *const inputDesc,
                                                acldvppPicDesc *const outputDesc,
                                                acldvppRoiConfig *const cropArea,
                                                acldvppRoiConfig *const pasteArea,
                                                acldvppResizeConfig *const resizeConfig,
                                                const aclrtStream stream) override;

        aclError acldvppVpcBatchCropAndPasteAsync(acldvppChannelDesc *const channelDesc,
                                                  acldvppBatchPicDesc *const srcBatchPicDescs,
                                                  uint32_t *const roiNums,
                                                  const uint32_t size,
                                                  acldvppBatchPicDesc *const dstBatchPicDescs,
                                                  acldvppRoiConfig *cropAreas[],
                                                  acldvppRoiConfig *pasteAreas[],
                                                  const aclrtStream stream) override;

        aclError acldvppVpcBatchCropResizePasteAsync(acldvppChannelDesc *const channelDesc,
                                                     acldvppBatchPicDesc *const srcBatchPicDescs,
                                                     uint32_t *const roiNums,
                                                     const uint32_t size,
                                                     acldvppBatchPicDesc *const dstBatchPicDescs,
                                                     acldvppRoiConfig *cropAreas[],
                                                     acldvppRoiConfig *pasteAreas[],
                                                     acldvppResizeConfig *const resizeConfig,
                                                     const aclrtStream stream) override;

        aclError acldvppVpcConvertColorAsync(acldvppChannelDesc *const channelDesc,
                                             acldvppPicDesc *const inputDesc,
                                             acldvppPicDesc *const outputDesc,
                                             const aclrtStream stream) const override;

        aclError acldvppVpcPyrDownAsync(acldvppChannelDesc *const channelDesc,
                                        acldvppPicDesc *const inputDesc,
                                        acldvppPicDesc *const outputDesc,
                                        void*const  reserve,
                                        const aclrtStream stream) const override;

        aclError acldvppVpcEqualizeHistAsync(const acldvppChannelDesc *const channelDesc,
                                             const acldvppPicDesc *const inputDesc,
                                             acldvppPicDesc *const outputDesc,
                                             const acldvppLutMap *const lutMap,
                                             const aclrtStream stream) const override;

        aclError acldvppVpcMakeBorderAsync(const acldvppChannelDesc *const channelDesc,
                                           const acldvppPicDesc *const inputDesc,
                                           acldvppPicDesc *const outputDesc,
                                           const acldvppBorderConfig *const borderConfig,
                                           const aclrtStream stream) const override;

        aclError acldvppVpcBatchCropResizeMakeBorderAsync(acldvppChannelDesc *const channelDesc,
                                                          acldvppBatchPicDesc *const srcBatchPicDescs,
                                                          uint32_t *const roiNums,
                                                          const uint32_t size,
                                                          acldvppBatchPicDesc *const dstBatchPicDescs,
                                                          acldvppRoiConfig *cropAreas[],
                                                          acldvppBorderConfig *borderCfgs[],
                                                          acldvppResizeConfig *const resizeConfig,
                                                          const aclrtStream stream) const override;

        aclError acldvppVpcCalcHistAsync(acldvppChannelDesc *const channelDesc,
                                         acldvppPicDesc *const srcPicDesc,
                                         acldvppHist *const hist,
                                         void *const reserve,
                                         const aclrtStream stream) const override;

        ~ImageProcessorV300() = default;

        // not allow copy constructor and assignment operators
        ImageProcessorV300(const ImageProcessorV300 &) = delete;

        ImageProcessorV300 &operator=(const ImageProcessorV300 &) = delete;

        ImageProcessorV300(ImageProcessorV300 &&) = delete;

        ImageProcessorV300 &operator=(ImageProcessorV300 &&) = delete;

        // constructor
        explicit ImageProcessorV300(const aclrtRunMode aclRunMode) : ImageProcessorV200(aclRunMode) {};

    private:
        aclError CreateHimpiChannel(acldvppChannelDesc *const channelDesc, const acldvppChannelMode &mode);
        aclError ProcessBatchCropResizePaste(const int32_t channelId,
            uint32_t *const roiNums,
            const uint32_t size,
            const acldvppBatchPicDesc *const srcBatchPicDescs,
            const acldvppBatchPicDesc *const dstBatchPicDescs,
            const acldvppRoiConfig *const cropAreas[],
            const acldvppResizeConfig *const resizeConfig,
            acldvppRoiConfig *pasteAreas[],
            const aclrtStream stream) const;

        aclError ProcessBatchCropResizeBorder(const int32_t channelId,
            uint32_t *const roiNums,
            const uint32_t size,
            const acldvppBatchPicDesc *const srcBatchPicDescs,
            const acldvppBatchPicDesc *const dstBatchPicDescs,
            const acldvppRoiConfig *const cropAreas[],
            const acldvppResizeConfig *const resizeConfig,
            acldvppBorderConfig *borderCfgs[],
            const aclrtStream stream) const;
    };
    }
}
#endif // IMAGE_PROCESSOR_V300_H
